﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Launchkit_Backend.model
{
    public static class EntryActions
    {
        public static Dictionary<string, Action<Launchkit_Backend.Form1, string>> actions;
        public static void init() {
            actions = new Dictionary<string, Action<Launchkit_Backend.Form1, string>>();
            actions.Add(ActionOpenFile, (form, param) =>
            {
                
                Process.Start("explorer", param);
            });
            actions.Add(ActionOpenDir, (form, param) =>
            {
                form.NavigateTo(DBUtils.getEntryById(int.Parse(param)));
            });
            actions.Add(ActionLink, (form, param) =>
            {
                form.NavigateTo(DBUtils.getEntryById(int.Parse(param)));
            });
            actions.Add(ActionCommand, (form, param) =>
            {
                Process.Start("cmd.exe", "/c " + param);
            });
            actions.Add(ActionWebsite, (form, param) =>
            {
                Process.Start("explorer", param);
            });
        }

        public const string ActionOpenFile = "exec";
        public const string ActionOpenDir = "dir";
        public const string ActionLink = "link";
        public const string ActionCommand = "cmd";
        public const string ActionWebsite = "url";

    }
}
